package com.example.dao;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.Collection;
import java.util.LinkedHashSet;

/**
 * Copyright © 2016年 author. All rights reserved.
 *
 * @Author 临江仙 hzqiuxm@163.com
 * @Date 2017/9/14 0014 16:37
 */
@Document //映射为mongoDb文档
public class PersonForMongoDB {

    @Id //id作为文档的id
    private String id;
    private String name;
    private Integer age;

    @Field("locs") //文档中保存名称为locs
    private Collection<Location> locationCollections = new LinkedHashSet<>();

    public PersonForMongoDB(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Collection<Location> getLocationCollections() {
        return locationCollections;
    }

    public void setLocationCollections(Collection<Location> locationCollections) {
        this.locationCollections = locationCollections;
    }
}
